package kr.hkit.powerjava.chapter21;

public class ArrayError {
	public static void main(String[] args) {
		int [] arr = {1,2,3,4,5};
		
		int i = 0;
		
		try{
			for(i = 0 ; i<=arr.length; i++){
			System.out.print(arr[i] + " ");
			}
		}catch(ArrayIndexOutOfBoundsException e){
			System.out.println("인덱스" + i + "사용불가" + e.getMessage());
			e.printStackTrace(); //원래 오류 메시지.. 
		}
	}
}
